package com.bootcamp.sb1126yml.config;

import com.alibaba.druid.pool.DruidDataSource;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.sql.DataSource;

/**
 * @program: spring-boot
 * @description:
 * @author: Keyu Li
 * @create: 2021-11-26 11:08
 **/

@Configuration
public class DataSourceConfiguration1 {
    @Value("${a.datasource.url}")
    String url;
    @Value("${a.datasource.username}")
    String username;
    @Value("${a.datasource.password}")
    String pass;

    @Bean("dataSource1")
    public DataSource dataSource(){
        DruidDataSource dataSource = new DruidDataSource();
        dataSource.setUrl(url);
        dataSource.setUsername(username);
        dataSource.setPassword(pass);
        return dataSource;
    }
}
